home *** CD-ROM | disk | FTP | other *** search
- I hacked up a script I found that can make your linux man pages World
- Wide Web readable. You just need to add some lines to your /etc/services
- and /etc/inetd.conf files, and put the following script in
- /usr/local/htfiled (or whereever inetd.conf points.) Then from a WWW
- browser such as xmosaic, open the URL http://yourhostname:1235/man
- You do need to have networking up with at least loopback.
-
- This way of reading man pages puts in a link wherever a man page refers to
- another man page, so it is easy to jump around the man pages. I find it
- more pleasant than using xman.
-
- #!/bin/bash
- #bogus http server functions, directory browser, man page reader, etc.
- #install a service htfile in /etc/services and /etc/inetd.conf as follows:
- #services:htfile 1235/tcp
- #inetd.conf:htfile stream tcp nowait www /usr/local/htfiled htfiled
- #(Make sure you have a www dummy account). makewhatis must have been run so
- # that /usr/man/whatis exists and man -k works.
- #
- # To access, use the URL http://hostname:1235/man
- #
- # This file was modified by Stephen Wood (saw@cebaf.gov) from a ksh version for
- # IRIX 4.0 man pages. It's copyright status is unknown.
- exec 2>&1
-
- #read get command line
- read get path
-
- #get rid of return character at end of get command
- ###path=`echo $path|sed s///`
- path=`echo $path|sed s/.$//`
-
- #parse arguments with / delimeter (this was a bad idea)
- dir="$path"
- cmd=`expr "$dir//" : '/\([^/]*\)/'`
- args=`expr "$dir" : '/[^/]*/\(.*\)'`
- dir=`expr "$dir" : '/[^/]*\(/.*\)'`
- arg=`expr "$dir//" : '/\([^/]*\)/'`
- dir=`expr "$dir" : '/[^/]*\(/.*\)'`
- arg2=`expr "$dir//" : '/\([^/]*\)/'`
-
- case $cmd in
-
- date) echo "<TITLE>Date and Time now</TITLE><H1>"`date`"</H1>Wanna see it again? Here it is: "`date`".<P>"
- ;;
-
- man)
- if [ "$arg2" = "" ]; then pre=""
- else pre="../"; fi
- case "$arg" in
- "")
- echo "<TITLE>Linux Manual Pages</TITLE><H1>Linux Manual Pages</H1>"
- echo "These are links to the Linux manual pages. You can"
- echo "look for information in several ways."
- echo "<p><dl>"
- echo "<dt><a name=id1 href=man/index>Keyword Search</a>"
- echo "<dd>where you can do a full text search for man pages"
- echo "that contain the keyword you specify."
- echo "<dt><a name=id2 href=man/section>By section</a>"
- echo "<dd>where you can browse the names of the man pages"
- echo "in a section and choose items of interest."
- echo "</dl>"
- exit
- ;;
- index*)
- ## I (saw) don't know what this ifs stuff does. It seems not to work without it though.
- ifs="$IFS"
- IFS="?$IFS"
- set $path
- dir=$1
- if [ "$2" = "" ]; then
- echo "<ISINDEX>"
- echo "<title>linux index</title>"
- echo "<h1>linux</h1>"
- echo "Type a keyword to search for in the Linux man pages."
- else
- echo "<TITLE>Find Linux Manual $2</TITLE><H1>$2 Keyword search</H1>"
- echo "<DL>"
- ### The big substitute a few lines below (and repeated later), attempts to get
- ### the first command mentioned on the line, since there may be only a man page for
- ### that command and not the others (since they are all covered in one man page.)
- ### This seems to work with the set of Linux man pages I have.
- man -k $2|sed '
- s/\&/\&/g
- s/</\</g
- s/>/\>/g
- s/^/<DT>/
- s/[ ]*- /<DD>- /
- s/()//
- s|<DT>([A-Za-z4][_A-Za-z0-9+]\{1,\})(.*)[ \t]*\(([1-9n][A-Za-z1-9]*)\)|<DT><A HREF=\1\/\3>\1(\3)<\/A>\2|g
- s/$//'
- echo "</DL>"
- fi
- exit
- ;;
- section*)
- ifs="$IFS"
- IFS="?$IFS"
- set $path
- dir=$1
- if [ "$2" = "" ]; then
- echo "<title>Man pages, by section, for Linux</title>"
- echo "<h1>Man pages, by section, for Linux</h1>"
- echo "Choose a section of the linux manual from the list below:<p>"
- echo "Section <a href=section?1>1</a> - Commands<p>"
- echo "Section <a href=section?2>2</a> - System calls<p>"
- echo "Section <a href=section?3>3</a> - Library calls<p>"
- echo "Section <a href=section?4>4</a> - Devices<p>"
- echo "Section <a href=section?5>5</a> - File formats<p>"
- echo "Section <a href=section?6>6</a> - Games<p>"
- echo "Section <a href=section?7>7</a> - Miscellaneous useful information<p>"
- echo "Section <a href=section?8>8</a> - System Administration<p>"
- echo "Section <a href=section?n>n</a> - New<p>"
- else
- echo "<title>Linux man pages for section $2</title><h1>Linux man pages for section $2</h1>"
- echo "Select this to go back up to the section list for the Linux"
- echo "man pages, or choose a man page from the list below:<p>"
- cat /usr/man/whatis | grep \($2\) |sed '
- s/\&/\&/g
- s/</\</g
- s/>/\>/g
- s/^/<DT>/
- s/[ ]*- /<DD>- /
- s/()//
- s|<DT>([A-Za-z4][_A-Za-z0-9+]\{1,\})(.*)[ \t]*\(([1-9n][A-Za-z1-9]*)\)|<DT><A HREF=\1\/\3>\1(\3)<\/A>\2|g
- s/$//'
- echo "</DL>"
- fi
- exit
- ;;
- esac
- echo "<TITLE>Linux Manual Page: $arg $arg2</TITLE><H1>Linux $arg.$arg2</H1>"
- echo "<PRE>"
- ##This sed replaces <'s, >'s and &'s with the right html directive. It also
- ##searches for what appear to be man page references and puts in links to those pages.
- man $arg2 $arg|col -bx|sed '
- s/\&/\&/g
- s/</\</g
- s/>/\>/g
- s|([A-Za-z4][_A-Za-z0-9+]\{1,\})[ \t]*\(([1-9n][A-Za-z1-9]*)\)|<A HREF='$pre'\1\/\2>\1(\2)<\/A>|g
- s/$//'
- ;;
-
- *) echo unrecognized command. $cmd
- ;;
-
- esac
- exit
- --
-
- ---------------------------------------------------------
- Stephen A. Wood CEBAF/SURA
- Internet: saw@hallc1.cebaf.gov Mail Stop 12H
- Internet: saw@cebaf.gov 12000 Jefferson Avenue
- Bitnet: saw@cebaf Newport News, VA 23606
-
- Phone: (804)249-7367 Office: CEBAF Center C121
- FAX: (804)249-7363
-
-